import DS from 'ember-data';
import BaseModel from './base-model';

var staffschedule = BaseModel.extend({
  user:DS.belongsTo('user'),//护工
  type:DS.belongsTo('dicttype'),//排班类型
  createDateTime:DS.attr('number'),//添加时间
  createUser:DS.belongsTo('user'),//排班人员
  startTime:DS.attr('number'),//开始时间
  endTime:DS.attr('number'),//结束时间
  remark:DS.attr('string'),//备注

  dateService: Ember.inject.service("date-service"),
  // planType:DS.belongsTo('dicttype'),//计划类型
  // customer:DS.belongsTo('customer'),//客户
  // lastUpdateDateTime:DS.attr('number'),//更新时间
  // lastUpdateUser:DS.belongsTo('user'),//更新人

  // services:DS.hasMany('staffscheduleitem'),//护理项目
  // planStartDateTime :Ember.computed("planStartTime",function(){
  //   var planStartDate=this.get("planStartTime");
  //   return this.get("dateService").timestampToTime(planStartDate);
  // }),
  startTimeDate:Ember.computed("startTime",function(){
    var startTime=this.get("startTime");
    return this.get("dateService").timestampToTime(startTime);
  }),
  startTimeString:Ember.computed("startTime",function(){
    var startTime=this.get("startTime");
    return this.get("dateService").formatDate(startTime,"yyyy-MM-dd");
    }),
  endTimeDate:Ember.computed("endTime",function(){
      var endTime=this.get("endTime");
      return this.get("dateService").timestampToTime(endTime);
    }),
  endTimeString:Ember.computed("endTime",function(){
      var endTime=this.get("endTime");
      return this.get("dateService").formatDate(endTime,"yyyy-MM-dd");
    }),

  createDateTimeString:Ember.computed("createDateTime",function(){
      var createDateTime=this.get("createDateTime");
      return this.get("dateService").formatDate(createDateTime,"yyyy-MM-dd");
    }),
});
export default staffschedule;
